import { Inject, Get, Query } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { OrderShareEntity } from '../../entity/share';
import { OrderShareService } from '../../service/share';
import { OrderOrderEntity } from '../../entity/order';

/**
 * 订单模块-店铺信息
 */
@CoolController({
  api: ['info', 'list', 'page'],
  entity: OrderShareEntity,
  service: OrderShareService,
  pageQueryOp: {
    fieldEq: ['a.shareStatus'],
    fieldLike: [],
    select: ['a.*'],
    join: [
      {
        entity: OrderOrderEntity,
        alias: 'b',
        condition: 'a.sysOrderId = b.id',
        type: 'leftJoin',
      },
    ],
  }
})
export class AdminOrderShareController extends BaseController {
  @Inject()
  orderShareService: OrderShareService;

  /**
   * 财务分页查询
   */
  @Get('/caiwuPage', { summary: '财务分页查询' })
  async caiwuPage(
    @Query() query: {}, options: {}
  ) {
    const result = await this.orderShareService.caiwuPage(query, options);
    return this.ok(result);
  }
}
